﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using mesoBoard.Data.Repositories;
using mesoBoard.Data;

namespace mesoBoard.Services
{
    public class ServicesWrapper : IServicesWrapper
    {
        private Users _Users;
        private Categories _Categories;
        private Forums _Forums;
        private Posts _Posts;
        private Threads _Threads;
        private Polls _Polls;
        private Files _Files;
        private Themes _Themes;
        private Search _Search;
        private Messages _Messages;
        private Global _Global;
        private ThreadImages _ThreadImages;
        private FileTypes _FileTypes;
        private Plugins _Plugins;
        private Roles _Roles;

        public Roles Roles
        {
            get
            {
                if (_Roles == null)
                    _Roles = new Roles(this.repos);

                return _Roles;
            }
        }

        public Plugins Plugins
        {
            get
            {
                if (_Plugins == null)
                    _Plugins = new Plugins(this.repos);

                return _Plugins;
            }
        }

        public FileTypes FileTypes
        {
            get
            {
                if (_FileTypes == null)
                    _FileTypes = new FileTypes(this.repos);

                return _FileTypes;
            }
        }

        public ThreadImages ThreadImages
        {
            get
            {
                if (_ThreadImages == null)
                    _ThreadImages = new ThreadImages(this.repos);

                return _ThreadImages;
            }
        }


        public Global Global
        {
            get
            {
                if (_Global == null)
                    _Global = new Global(this.repos);

                return _Global;
            }
        }


        public Users Users
        {
            get
            {
                if(_Users == null)
                    _Users = new Users(this.repos);

                return _Users;
            }
        }
        public Categories Categories
        {
            get
            {
                if(_Categories == null)
                    _Categories = new Categories(this.repos);

                return _Categories;
            }
        }
        public Forums Forums
        {
            get
            {
                if(_Forums == null)
                    _Forums = new Forums(this.repos);

                return _Forums;
            }
        }
        public Posts Posts
        {
            get
            {
                if(_Posts == null)
                    _Posts = new Posts(this.repos);

                return _Posts;
            }
        }

        public Search Search
        {
            get
            {
                if (_Search == null)
                    _Search = new Search(this.repos);

                return _Search;
            }
        }

        public Threads Threads
        {
            get
            {
                if(_Threads == null)
                    _Threads = new Threads(this.repos);

                return _Threads;
            }
        }
        public Polls Polls
        {
            get
            {
                if(_Polls == null)
                    _Polls = new Polls(this.repos);

                return _Polls;
            }
        }
        public Files Files
        {
            get
            {
                if (_Files == null)
                    _Files = new Files(this.repos);

                return _Files;
            }
        }
        public Themes Themes
        {
            get
            {
                if(_Themes == null)
                    _Themes = new Themes(this.repos);

                return _Themes;
            }
        }
        public Messages Messages
        {
            get
            {
                if(_Messages == null)
                    _Messages = new Messages(this.repos);

                return _Messages;
            }
        }

        private IRepositoriesWrapper repos;

        public ServicesWrapper(IRepositoriesWrapper repos)
        {
            this.repos = repos;
        }
    }
}
